﻿// owner 蒋家伟

#include "TaskRegisterUtils.h"

// jsdk
#include "ITaskExectutable.h"
#include "TaskManager.h"
#include "Dbg_Warn_Define.h"

using namespace jsdk;

void jsdk::TaskRegisterUtils::registerTaskExecutable(const std::wstring & taskDescrition, const TaskTaskExectutableCreator& taskExectutableCreator)
{
    DBG_WARN_AND_RETURN_VOID_UNLESS(taskExectutableCreator, L"不可给任务 <" + taskDescrition + L"> 注册一个空执行者", L"蒋家伟" , L"2023-08-03");
    bool success = TaskManager::get().registerTaskExctutable(taskDescrition, taskExectutableCreator);
    DBG_WARN_AND_RETURN_VOID_UNLESS(success, L"任务 <" +taskDescrition + L" > 执行者注册失败, 一个任务只能注册一次", L"蒋家伟", L"2023-08-03");
}
